package com.dupt.system.service.impl;

import java.util.List;
import com.dupt.common.utils.DateUtils;
import com.dupt.common.utils.SecurityUtils;
import com.dupt.system.domain.param.MaintenanceParam;
import com.dupt.system.domain.param.MaintenanceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dupt.system.mapper.MaterialMaintenanceMapper;
import com.dupt.system.domain.MaterialMaintenance;
import com.dupt.system.service.IMaterialMaintenanceService;

/**
 * 维保信息Service业务层处理
 * 
 * @author zhuanyu.sun
 * @date 2025-07-22
 */
@Service
public class MaterialMaintenanceServiceImpl implements IMaterialMaintenanceService
{
    @Autowired
    private MaterialMaintenanceMapper materialMaintenanceMapper;

    /**
     * 查询维保信息
     * 
     * @param maintenanceId 维保信息主键
     * @return 维保信息
     */
    @Override
    public MaterialMaintenance selectMaterialMaintenanceByMaintenanceId(Long maintenanceId)
    {
        return materialMaintenanceMapper.selectMaterialMaintenanceByMaintenanceId(maintenanceId);
    }

    /**
     * 查询维保信息列表
     * 
     * @param maintenanceParam 维保信息
     * @return 维保信息
     */
    @Override
    public List<MaintenanceVo> selectMaterialMaintenanceList(MaintenanceParam maintenanceParam)
    {
        return materialMaintenanceMapper.selectMaterialMaintenanceList(maintenanceParam);
    }

    /**
     * 新增维保信息
     * 
     * @param materialMaintenance 维保信息
     * @return 结果
     */
    @Override
    public int insertMaterialMaintenance(MaterialMaintenance materialMaintenance)
    {
        materialMaintenance.setCreateTime(DateUtils.getNowDate());
        materialMaintenance.setCreateBy(SecurityUtils.getLoginUser().getUsername());
        return materialMaintenanceMapper.insertMaterialMaintenance(materialMaintenance);
    }

    /**
     * 修改维保信息
     * 
     * @param materialMaintenance 维保信息
     * @return 结果
     */
    @Override
    public int updateMaterialMaintenance(MaterialMaintenance materialMaintenance)
    {
        materialMaintenance.setUpdateTime(DateUtils.getNowDate());
        return materialMaintenanceMapper.updateMaterialMaintenance(materialMaintenance);
    }

    /**
     * 批量删除维保信息
     * 
     * @param maintenanceIds 需要删除的维保信息主键
     * @return 结果
     */
    @Override
    public int deleteMaterialMaintenanceByMaintenanceIds(Long[] maintenanceIds)
    {
        return materialMaintenanceMapper.deleteMaterialMaintenanceByMaintenanceIds(maintenanceIds);
    }

    /**
     * 删除维保信息信息
     * 
     * @param maintenanceId 维保信息主键
     * @return 结果
     */
    @Override
    public int deleteMaterialMaintenanceByMaintenanceId(Long maintenanceId)
    {
        return materialMaintenanceMapper.deleteMaterialMaintenanceByMaintenanceId(maintenanceId);
    }
}
